package com.cssl.service.impl;

import java.sql.SQLException;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.cssl.dao.UsersDao;
import com.cssl.pojo.Users;
import com.cssl.service.UsersService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;

@Transactional
@Service
public class UsersServiceImpl  implements UsersService {

	@Autowired
	private UsersDao udao;

	@Override
	public boolean saveUsers(Users user) throws SQLException {
		System.out.println("UsersServiceImpl saveUsers...");		
		if(udao.insert(user)>0) {		
			return true;
		}			
		return false;
	}


	@Override
	public int removeById(int id) {
		System.out.println("UsersServiceImpl removeById");
		return 0;
	}


	@Override
	public Page<Users> findPage(int pageIndex,int pageSize) {
		Page<Users> page = PageHelper.startPage(pageIndex, pageSize);
		udao.select();
		return page;
	}

}
